<?php defined('_JEXEC') or die('Restricted access');
require_once(JPATH_SITE.DS.'components'.DS.'com_ecommerce'.DS.'models'.DS.'orders.php');
$orders = $this->orders;
?>
<script type="text/javascript">
	$(window).load(function() { 
		$('div#st_horizontal').slideTabs();
		$('.accordion-content').show();
		$('.accordion-first').hide();
	});
</script>
<!-- Begin main content -->
<div id="main">
	<div id="content">
		<!-- Begin bestil content  -->
		<div class="content-ctn">
			<div id="bestilContent">
				<nav id="bestilNav">
					<ul>
						<li><a href="index.php?option=com_ecommerce&view=list&Itemid=24"><span class="title">BESTIL Rengøring</span><span class="note">Se vores udvalg af tjenester</span></a></li>
						<li class="active"><a href="index.php?option=com_ecommerce&view=orders&Itemid=24"><span class="title">MINE BESTILINGER</span><span class="note">Hvad har jeg tidligere bestilt</span></a></li>
						<li><a href="index.php?option=com_user&view=user&layout=myprofile"><span class="title">Min profil</span><span class="note">se og redigere min profil</span></a></li>
					</ul>
					<div id="minicart">{module minicart}</div>
				</nav>
				<div id="mineBestilinger">
					<div class="bestil-title-bar">
						<span>Bestil dato</span><span>Udførelses dato</span><span>Ordrenummer</span><span>Antal ydelser</span><span>Beløb</span><span>Status</span>
					</div>
					<?php 
						foreach($this->orders as $key=>$value):
					?>
					<div class="accordion-header"><span><?php echo strftime("%d-%m-%Y",strtotime($value->order_date)) ;?></span><span><?php echo strftime("%d-%m-%Y",strtotime($value->order_finished));?></span><span><?php echo str_pad($value->order_id,6,"0",STR_PAD_LEFT);?></span><span><?php echo $value->order_amount;?></span><span><?php echo $value->order_total;?> DKK</span><span><?php echo $value->order_status==0?"Udført":"Ventert"; ?></span></div>					
					<div class="accordion-content accordion-first" style="display: block;">
						<!-- Horizontal tabs -->
						<div id="st_horizontal" class="st_horizontal">                                                

							<div class="st_tabs_container st_sliding_active">								
								<a href="#prev" class="st_prev" title="Forrige rengøring område"></a>
								
								<div style="overflow: hidden;" class="st_slide_container">
								
									<ul class="st_tabs">
										<?php
											$i=1; 
											foreach($this->listcategory as $l=>$c):
										?>
											<li><a href="#st_content_<?php echo $i?>" rel="tab_<?php echo $i;?>" class="st_tab<?php if($i==1){?> st_first_tab st_tab_active <?php }?>"><?php echo $c->name?></a></li>
										<?php $i++;?>
										<?php endforeach;?>
									</ul>
								
								</div> <!-- /.st_slide_container -->
								
								<a href="#next" class="st_next" title="Mere rengøring område"></a>                                                                                                
							
							</div> <!-- /.st_tabs_container -->
						   
							<div class="st_view_container">                    
								
								<div class="st_view">                 
									<?php $countk=1;?>                 
									<?php foreach($this->listcategory as $l=>$c):?>		
									<div id="st_content_<?php echo $countk; ?>" class="st_tab_view<?php if($countk==1){ ?> st_first_tab_view st_active_view<?php } ?>">
										<div class="title-bar">
											<h2>BESTIL STUEPLAN Rengøring</h2>
											<?php
												$model = new EcommerceModelOrders();
												$result = $model->getProductByORdersID($value->order_id,$c->id);
												$listproduct = $result["data"];
												$link = $result["link"];
											?>
											<!-- Pager-->
											<div class="navigator-bar fl-right">
												<div id="pagination" class="pager fl-right">
													<!-- enable this line if the current page is the last
													<a class="page-first link-btn">First</a>
													-->
													<?php echo $link;?>
												</div>
											</div>
											<!-- /Pager-->
											<!-- 
											<div class="sort fl-right">
												<label>Sortering</label>
												<select id="sortOrder">
													<option>Diverse A - Z</option>
													<option>Diverse Z - A</option>
												</select>
												<label>Visning</label>
												<select id="viewNum">
													<option>10</option>
													<option>20</option>
													<option>30</option>
													<option>Alle</option>
												</select>
											</div>
											 -->
										</div>
										<div class="table-list">
											<table class="order">
												<tbody>
													<tr class="first">
														<th width="450" class="left">Navn område</th>
														<th width="60">Kvalitet</th>
														<th width="148" class="right">Pris (DKK)</th>
													</tr>
													<?php
														$j=1;
														$totalprice = 0;
														if(count($listproduct)){
														foreach($listproduct as $k=>$v):	
													?>
													<tr <?php if($j%2==0){ ?>class="odd"<?php }else{?>class="even"<?php }?>>
														<td class="area-name left"><?php echo $v->name;?></td>
														<td><?php echo $v->ptype?></td>
														<td width="148" class="price right"><?php echo $this->formatPrice($v->price);?></td>
													</tr>
													<?php 
														$j++;
														$totalprice += $v->price;
														endforeach;
														}
													?>
													<tr class="bottom">
														<td class="right" colspan="2">Subtotal på kategori "Stueplan" :</td>
														<td class="sub-total right"><?php echo $this->formatPrice($totalprice)?></td>
													</tr>
												</tbody>
											 </table>
										</div>                            
									</div>
									<?php $countk++;?>
                                    <?php endforeach;?>
								</div> <!-- /.st_view -->
							</div> <!-- /.st_view_container -->                                          
						
						</div>         
						<!-- End Horizontal tabs -->
					</div>			                                  
					<?php
						endforeach;
					?>
					
				</div>
				
			</div>
		</div>
		<!-- / bestil content  -->
		
	</div>
	<!-- / main-content  -->
	  
	<!-- /end mid-content  -->
</div>